﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Backend.JYD.BLL.Cust;

namespace Backend.JYD.Web.Controllers.Cust
{
    public class AssetController : Controller
    {
        //
        // GET: /Assets/
        CustAssetsBLL bll = new CustAssetsBLL();

        public ActionResult Index()
        {
            var list = bll.GetCustAssetByPage(new Model.PageInfo() { PageIndex = 1, PageSize = 20 });

            return View(list.PageList);
        }

        //
        // GET: /Assets/Details/5

        public ActionResult Details(String cno)
        {
            var info = bll.GetCustAssetByCustNos(new List<String>() { cno });
            return View(info);
        }

        //
        // GET: /Assets/Create

        public ActionResult Create()
        {
            return View();
        }

        //
        // POST: /Assets/Create

        [HttpPost]
        public ActionResult Create(FormCollection collection)
        {
            return View();
        }

        //
        // GET: /Assets/Edit/5

        public ActionResult Edit(String cno)
        {
            var info = bll.GetCustAssetByCustNos(new List<String>() { cno });
            return View(info);
        }

        //
        // POST: /Assets/Edit/5

        [HttpPost]
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

        //
        // GET: /Assets/Delete/5

        public ActionResult Delete(int id)
        {
            return View();
        }

        //
        // POST: /Assets/Delete/5

        [HttpPost]
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
    }
}